Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modify Makefile and Dockerfiles to speed up builds #44

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

HartS
Copy link

@HartS HartS commented Apr 28, 2017

This PR speeds up the build process by keeping a base image for each targeted platform, and moving the COPY step from the Dockerfiles into a separate Dockerfile which gets built from the base image. The base images will only be rebuilt when the user has deleted them, or when the GO_VERSION or MACHINE_VERSION has changed since they were built. In case of GO_VERSION or MACHINE_VERSION changing, the cache will be reused from the previous build (which is most useful for the steps where the libvirt package installed, which requires update/refreshing package repositories in addition to downloading the packages). The image which gets the repo root copied in, and associated container which actually performs the go get ... && go install ... are still deleted after each build.

This PR also:

  • Moves the Dockerfiles which create the base images into a 'dockerfiles/' directory
  • Changes the destination path of the compiled binaries to './out/'
  • Adds a .dockerignore which will prevent the binaries from being copied into the build image on successive builds

Build a base docker image for each platform with the requisite go
executable, libvirt packages, and docker-machine source. When making
releases, this base image will be used to build a second temporary
image in which the source directory is mounted. This image is then used
to launch a container in which the executable is built, after which
both container and build image are removed.

This speeds up compilation of the executables for each platform and
allows for testing changes on all platforms more quickly
@HartS
Copy link
Author

HartS commented Apr 28, 2017

This PR also includes the Dockerfile for a base openSUSE image, so supersedes the need for PR #43

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant